#include <stdio.h>
#include "typedef.h"
#include "bitmap.h"
#include "convert.h"
#include "geometric.h"

int main() {

  Bitmap src, gray, trans, hmirr, vmirr, scale,hshear,vshear;
  FILE *fpw;
  int t;

  CheckPath("./test.bmp");
  ReadBitmap("./test.bmp", &src);

  RGBToGray(&src, &gray);


  fpw = fopen("gray.bmp", "wb");
  SaveBitmap("gray.bmp", &gray);
  fclose(fpw);


  fpw= fopen("trans.bmp", "wb");
  Translation(&gray, &trans, -50, 50);
  SaveBitmap("trans.bmp", &trans);
  fclose(fpw);

  fpw = fopen("hmirr.bmp", "wb");
  Mirror(&gray, &hmirr, H);
  SaveBitmap("hmirr.bmp", &hmirr);
  fclose(fpw);

  fpw= fopen("vmirr.bmp", "wb");
  Mirror(&gray, &vmirr, V);
  SaveBitmap("vmirr.bmp", &vmirr);
  fclose(fpw);

  fpw = fopen("scale.bmp", "wb");
  Scale(&gray, &scale, 0.5);
  SaveBitmap("scale.bmp",&scale);
  fclose(fpw);

  fpw=fopen("hshear.bmp","wb");
  Shear(&gray,&hshear,45,H);
  SaveBitmap("hshear.bmp",&hshear);
  fclose(fpw);

  fpw=fopen("vshear.bmp","wb");
  Shear(&gray,&vshear,45,V);
  SaveBitmap("vshear.bmp",&vshear);
  fclose(fpw);




  return 0;

}